<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head th:replace="admin/_fragments :: head(~{::title})">
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/semantic-ui@2.4.2/dist/semantic.min.css">
    <link rel="stylesheet" th:href="@{/css/me.css}">
    <title>登陆</title>
</head>
<body>
<br>
<br>
<br>
<div class="m-padded-tb-massive" style="width: 70em; padding-left: 500px">
    <div class="ui container">
        <div class="ui middle aligned center aligned grid">
            <div class="column">
                <h2 class="ui black image header">
                    <img th:src="@{/images/headphoto.JPG}" class="ui rounded image" style="width: 100px"/>
                    <div class="content">
                        后台管理登陆
                    </div>
                </h2>
                <form class="ui large form" method="post" action="#" th:action="@{/admin/login}">
                    <div class="ui segment m-padded-tb-background1">
                        <div class="field">
                            <div class="ui left icon input">
                                <i class="user icon"></i>
                                <input type="text" name="username" placeholder="用戶名">
                            </div>
                        </div>
                        <div class="field">
                            <div class="ui left icon input">
                                <i class="lock icon"></i>
                                <input type="password" name="password" placeholder="密碼">
                            </div>
                        </div>
                        <button class="ui fluid large brown submit button">登&nbsp;&nbsp;&nbsp;&nbsp;錄</button>
                    </div>

                    <div class="ui error mini message">

                    </div>
                    <!--th:unless:只有非空時才會顯示消息區域-->
                    <div class="ui mini negative message" th:unless="${#strings.isEmpty(message)}" th:text="${message}">
                        用戶名和密碼錯誤
                    </div>

                </form>


            </div>
        </div>
    </div>
</div>


<!--底部footer-->
<!--/*/<th:block th:replace="admin/_fragments :: script">/*/-->
<script src="https://cdn.jsdelivr.net/npm/jquery@3.2/dist/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/semantic-ui/2.2.4/semantic.min.js"></script>
<!--/*/</th:block>/*/-->
<script th:inline="javascript">
    $('.ui.form').form({
        fields: {
            username: {
                identifier: 'username',
                rules: [{
                    type: 'empty',
                    prompt: '請輸入用戶名'
                }]
            },
            password: {
                identifier: 'password',
                rules: [{
                    type: 'empty',
                    prompt: '請輸入密碼'
                }]
            },
        }
    });
</script>
</body>
</html>